import { query } from '../services/orders';
export default {
  namespace: 'orders',
  state: {
    test: '00000'
  },
  effects: {
    *getOrders({ paylaod }, { call, put }) {
      const { data: { message, orders } } = yield call(query);
      message === 'success' ? paylaod.success() : paylaod.failed();
      yield put({ type: 'update', data: orders });
    }
  },
  reducers: {
    update(state, action) {
      return { ...state, data: action.data };
    }
  }
}